home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / utilitys / 435 / format2x / format2x.lst next >
Encoding:
File List  |  1990-11-13  |  8.0 KB  |  233 lines

  1. Rem  Multi-Disk, Multi-Drive Formatting Utility    V.1.0
  2. Rem  By Bob Retelle,  December 1987
  3. '
  4. Rem  Written for the Michigan Atari Magazine
  5. Rem  3487 Braeburn Circle, Ann Arbor, MI  48108
  6. '
  7. Rem  Requires GFA BASIC and TWO disk drives
  8. '
  9. Restart:
  10. Rez=Xbios(4)  ! Rez=0=Low Rez,  Rez=1=Medium Rez,  Rez=2=High Rez
  11. If Rez=0
  12.   Alert 0,"  Sorry, the Formatter|    will only work in|MED or HIGH resolution..!",1,"Drat!",Button
  13.   End
  14. Endif
  15. '
  16. Drv%=1       !Start with Drive A  (will be reversed first time through)
  17. Fat%=5       !5 File allocation table sectors allocated
  18. Di%=112      !112 directory entried allowed
  19. Disks%=1     !Count how many disks have been formatted
  20. '
  21. Defline 1,5
  22. Deftext 1,0,0,6 !For Hi Rez: 1,0,0,13
  23. '
  24. Gosub Makemouse !Customize mouse pointer
  25. Gosub Credits
  26. Gosub Choices
  27. Gosub Warning
  28. '
  29. Disk%=Disk%-(Auto=3) !If Option 3 is chosen, start with a count of 2
  30. '
  31. Do                 !Main program loop
  32.   If Auto=3        !Format both drives simultaneously
  33.     Drv%=0
  34.     Gosub Prompt2
  35.     Gosub Format
  36.     Gosub Prompt3
  37.     Inc Disks%
  38.     Key=Asc(A$)
  39.     Goto Action
  40.   Endif
  41.   Drv%=Abs(Drv%=0) !Alternate Drives
  42.   If Auto=2        !Option 2, automatic alternating of drives
  43.     Gosub Prompt
  44.     Print Chr$(7); !Ring the bell
  45.     Gosub Format
  46.     Goto Action
  47.   Endif
  48.   '
  49.   Cls              !Option 1, prompted alternating of drives
  50.   Print Chr$(7);   !Ring the bell
  51.   A$="     Drive A"
  52.   If Drv%
  53.     A$="     Drive B"
  54.   Endif
  55.   Alert 0,"  Ready to FORMAT|"+A$+"|Insert new disk and|    press RETURN",1,"FORMAT|Abort",Button
  56.   If Button=2
  57.     Goto Abort
  58.   Endif
  59.   Gosub Prompt
  60.   Gosub Format
  61.   '
  62.   Action:
  63.   If Key=27        !Quit if ESC has been pressed
  64.     Goto Abort
  65.   Endif
  66.   Inc Disks%       !Count total disks formatted
  67. Loop
  68. '
  69. Abort:
  70. Cls
  71. Alert 0,"      All done?      ",1,"Yes/Quit|Restart",Key
  72. If Key=2
  73.   Clear
  74.   Goto Restart
  75. Endif
  76. End
  77. Rem ################ CREDITS procedure ###################
  78. Procedure Credits                                            !HI REZ:
  79.   Rbox 100,20,540,170                                        !100,20,540,290
  80.   Text 188,45,"MULTI-DRIVE, MULTI-DISK FORMATTER"            !188,50
  81.   Text 260,65,"By Bob Retelle"                               !260,89
  82.   Text 156,85,"Written with GFA BASIC, the GFA BASIC BOOK"   !156,133
  83.   Text 228,95,"the GFA BASIC COMPANION"                      !228,155
  84.   Text 196,115,"Requires TWO floppy disk drives"             !196,199
  85.   Text 204,125,"either Single or Double sided"               !204,221
  86.   Text 292,145,"V. 1.0"                                      !292,265
  87.   Repeat
  88.     A$=Inkey$
  89.     K=Mousek
  90.   Until K=1 Or Asc(A$)   !Wait until mouse button or key is pressed
  91.   Pause 10
  92.   Cls
  93. Return
  94. Rem ################ CHOICES procedure ###################
  95. Procedure Choices
  96.   Alert 0,"  Do you want to|Format with 9 or 10|sectors per track?",1,"-9-|-10-",Button
  97.   Rem Change this number to 2 to default to 10 Sectors per Track    ^
  98.   Spt%=9-(Button=2)
  99.   '
  100.   Alert 0,"  Do you want to|format with 80 or 82|  tracks per disk?",1,"-80-|-82-",Button
  101.   Rem Change this number to 2 to default to 82 Tracks per disk       ^
  102.   Trk%=80-2*(Button=2)
  103.   '
  104.   Alert 0,"Do you want to|format Single or|Double sided?",1,"SINGLE|DOUBLE",Button
  105.   Rem Change this number to 2 to default to Double Sided  ^
  106.   Sid%=1-(Button=2)
  107.   '
  108.   Alert 0,"     Do you want PROMPTED,| CONTINUOUS or SIMULTANEOUS|     formatting?",1,"PROMPT|CONT|SIMUL",Auto
  109. Return
  110. Rem ################ WARNING procedure ###################
  111. Procedure Warning                                            !HI REZ:
  112.   Rbox 100,20,540,170                                        !100,20,540,320
  113.   Text 220,35,"*** STANDARD WARNING ***"                     !220,40
  114.   Text 244,65,"FROM THIS POINT ON"                           !244,89
  115.   Text 284,75,"* ANY *"                                      !244,111
  116.   Text 212,85,"DISK IN EITHER DRIVE A OR B"                  !212,133
  117.   Text 284,95,"WILL  BE"                                     !284,155
  118.   Text 276,105,"* ERASED *"                                  !276,199
  119.   Text 196,125,"BE SURE THAT YOU HAVE REMOVED YOUR"          !196,121
  120.   Text 274,135,"PROGRAM DISK"                                !274,243
  121.   Text 168,145,"AND ARE READY TO PROCEED WITH FORMATTING"    !168,265
  122.   Text 258,155,"YOUR BLANK DISKS"                            !258,287
  123.   Wait:          !Wait until mouse button is pressed, or any key press
  124.   Repeat
  125.     A$=Inkey$
  126.     K=Mousek
  127.   Until K=1 Or Asc(A$)
  128.   Pause 10
  129.   Cls
  130. Return
  131. Rem ###################PROMPT PROCEDURE##############
  132. Procedure Prompt                                           !HI REZ:
  133.   Rbox 150,20,490,140                                      !150,20,490,260
  134.   Text 232,45,"INSERT NEW DISK INTO"                       !232,57
  135.   D$="DRIVE A"
  136.   If Drv%=0
  137.     D$="DRIVE B"
  138.   Endif
  139.   Text 286,55,D$                                           !286,79
  140.   Text 232,75,"SO IT CAN BE FORMATTED"                     !232,123
  141.   Text 254,85,"WHEN THE DISK IN"                           !254,145
  142.   A$="DRIVE B"
  143.   If Drv%=0
  144.     A$="DRIVE A"
  145.   Endif
  146.   Text 286,95,A$                                           !286,167
  147.   Text 272,105,"IS FINISHED"                               !272,189
  148.   Text 244,115,"(PRESS ESC TO QUIT)"                       !244,211
  149.   Text 224,125,"Total disks formatted="+Str$(Disks%)       !224,233
  150. Return
  151. Procedure Prompt2
  152.   Cls
  153.   Rbox 150,20,490,85                                  !150,20,490,140
  154.   Text 262,45," **STAND BY**"                         !262,57
  155.   Text 222,65,"NOW FORMATTING BOTH DRIVES"            !221,101
  156. Return
  157. Procedure Prompt3
  158.   Cls
  159.   Rbox 150,20,490,85                                  !150,20,490,140
  160.   Text 272,45,"SWITCH DISKS"                          !272,57
  161.   Text 222,55,"PRESS ANY KEY TO CONTINUE"             !222,79
  162.   Text 244,65,"(PRESS ESC TO QUIT)"                   !244,101
  163.   Repeat
  164.     Print Chr$(7);
  165.     A$=Inkey$
  166.     Pause 15
  167.   Until Asc(A$)
  168. Return
  169. Rem ##################### FORMAT PROCEDURE #####################
  170. Procedure Format         !Based on GFA BASIC Book from MichTron
  171.   X=55-24*(Rez=2)        !Position for printing message
  172.   Buf$=String$(20000,0)  !Buffer to hold Boot Sector info
  173.   Void Fre(0)            !Make sure String doesn't move
  174.   Buf%=Varptr(Buf$)      !Find start of buffer
  175.   For T%=0 To Trk%-1
  176.     For S%=0 To Sid%-1
  177.       If Auto=3
  178.         Drv%=0
  179.       Endif
  180.       Print At(28,18);"Formatting Side ";S%+1;", Track ";T%;" ";
  181.       If Auto<>3
  182.         If T%/2=Int(T%/2)  !Flash next Drive message
  183.           Text 286,X,D$
  184.         Else
  185.           Text 286,X,"        "
  186.         Endif
  187.       Endif
  188.       Otherdrive:
  189.       E%=Xbios(10,L:Buf%,L:0,Drv%,Spt%,T%,S%,1,L:&H87654321,0) !Format call
  190.       If E%
  191.         Print At(26,19);"Error formatting Side ";S%+1;" Track ";T%;
  192.       Endif
  193.       If Auto=3 And Drv%=0
  194.         Drv%=1
  195.         Goto Otherdrive
  196.       Endif
  197.     Next S%
  198.   Next T%
  199.   Gosub Boot
  200.   If Auto=3
  201.     Drv%=0
  202.     Gosub Boot
  203.   Endif
  204.   Key=Asc(Inkey$)
  205. Return
  206. Procedure Boot
  207.   Rem Create Boot Sector information in Buffer$
  208.   Sec%=Trk%*Spt%*Sid%
  209.   Buf$=String$(6,0)+Mkl$(Xbios(17))+Chr$(0)+Mki$(2)+Chr$(2)
  210.   Buf$=Buf$+Mki$(&H100)+Chr$(2)+Chr$(Di%)+Chr$(Di%/256)
  211.   Buf$=Buf$+Chr$(Sec%)+Chr$(Sec%/256)+Chr$(Med%)
  212.   Buf$=Buf$+Mki$(Fat%*256)+Mki$(Spt%*256)+Mki$(Sid%*256)
  213.   Buf$=Buf$+Mki$(0)+String$(512,0)
  214.   Void Xbios(9,L:Varptr(Buf$),L:0,Drv%,1,0,0,1)
  215.   Void Bios(7,Drv%)
  216.   Buf$=Mkl$(&HF7FFFF00)+String$(508,0)
  217.   Void Bios(4,1,L:Varptr(Buf$),1,1,Drv%)
  218.   Void Bios(4,1,L:Varptr(Buf$),1,Fat%+1,Drv%)
  219. Return
  220. Rem ############ MAKE MOUSE PROCEDURE ###############
  221. Rem From Mouse Editor provided with GFA BASIC
  222. Procedure Makemouse
  223.   Let Mouse$=Mki$(0)+Mki$(3)+Mki$(1)
  224.   Let Mouse$=Mouse$+Mki$(0)+Mki$(1)
  225.   For I%=1 To 32
  226.     Read Byte
  227.     Let Mouse$=Mouse$+Mki$(Byte)
  228.   Next I%
  229.   Data 7224,8184,8184,32190,24570,32766,4080,4080,8184,16380,16380,16380,16376,8176,4092,2044
  230.   Data 2064,3120,4080,3504,16380,2016,2016,2016,4080,8184,8184,8184,4080,2016,512,1016
  231.   Defmouse Mouse$
  232. Return
  233.